class MyBitmapTest extends egret.DisplayObjectContainer {

    constructor() {
        super();
        this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
    }

    public async onAddToStage(event:egret.Event) {
        RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE, this.onGroupComplete, this);

        await RES.loadConfig("resource/default.res.json", "resource/");
        await RES.loadGroup("preload");
    }

    private onGroupComplete() {
        var img:egret.Bitmap = new egret.Bitmap();
        img.texture = RES.getRes('radiobutton_select_up_png');
        img.x = 200;
        img.y = 200;
        img.scaleX = 5;
        img.scaleY = 5;
        this.addChild(img);

        var btn:egret.Bitmap = new egret.Bitmap();
        btn.texture = RES.getRes('radiobutton_select_up_png');
        var rect:egret.Rectangle = new egret.Rectangle(10,10,2,2);
        btn.scale9Grid = rect;
        btn.width *= 10;
        btn.height *= 4;
        btn.x = 100;
        btn.y = 400;
        this.addChild(btn);

        var bg:egret.Bitmap = new egret.Bitmap();
        bg.texture = RES.getRes('bg_jpg');
        this.addChildAt(bg, 0);

        var vanessaTexture:egret.Texture = RES.getRes('vanessa_json#fist0');
        var vanessa:egret.Bitmap = new egret.Bitmap(vanessaTexture);
        this.addChild(vanessa);
    }
}